#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include<stdbool.h>
typedef struct ListNode
{
	int val;
	struct ListNode* next;
}ListNode;

bool chkPalindrome(ListNode* phead)
{
		if (phead == NULL)
		{
			return false;
		}
		struct ListNode* fast = phead->next;
		struct ListNode* slow = phead;
		while (fast != slow)
		{
			if (fast == NULL || fast->next == NULL)
			{
				return false;
			}
			fast = fast->next->next;

			slow = slow->next;
		}
		return true;


}

int main()
{
	struct ListNode* n1 = (struct ListNode*)malloc(sizeof(struct ListNode));
	assert(n1);
	struct ListNode* n2 = (struct ListNode*)malloc(sizeof(struct ListNode));
	assert(n2);
	struct ListNode* n3 = (struct ListNode*)malloc(sizeof(struct ListNode));
	assert(n3);
	struct ListNode* n4 = (struct ListNode*)malloc(sizeof(struct ListNode));
	assert(n4);
	struct ListNode* n5 = (struct ListNode*)malloc(sizeof(struct ListNode));
	assert(n5);
	struct ListNode* n6 = (struct ListNode*)malloc(sizeof(struct ListNode));
	assert(n6);
	n1->val = 1;
	n2->val = 2;
	n3->val = 3;
	n4->val = 3;
	n5->val = 2;
	n6->val = 6;



	n1->next = n2;
	n2->next = n3;
	n3->next = n4;
	n4->next = n5;
	n5->next = n6;
	n6->next = NULL;

	bool ret = chkPalindrome(n1, 3);


	return 0;
}